home *** CD-ROM | disk | FTP | other *** search
- function getCurve()
- {
- pos_array[0].rotation = pos_array[1].rotation;
- delete line.onEnterFrame;
- line1.clear();
- }
- function clearUseDraw()
- {
- board_use.save_btn._visible = false;
- board_use.setup_btn._visible = false;
- board_use.crt_road_btn._visible = false;
- board_use.play_btn._visible = false;
- delete line.onEnterFrame;
- curvePos = 0;
- line.clear();
- line1.clear();
- line2.clear();
- }
- function postoRoad(pos_array)
- {
- mouth_start._x = pos_array[0].x;
- mouth_start._y = pos_array[0].y;
- mouth._x = pos_array[pos_array.length - 1].x;
- mouth._y = pos_array[pos_array.length - 1].y;
- line.clear();
- line1.clear();
- line2.clear();
- line.lineStyle(road_width,road_color,road_alpha);
- line2.lineStyle(road_center_width,road_center_color,road_center_alpha);
- line.moveTo(pos_array[0].x,pos_array[0].y);
- line2.moveTo(pos_array[0].x,pos_array[0].y);
- i = 1;
- while(i < pos_array.length)
- {
- line.lineTo(pos_array[i].x,pos_array[i].y);
- line2.lineTo(pos_array[i].x,pos_array[i].y);
- i++;
- }
- line.cacheAsBitmap = true;
- line1.cacheAsBitmap = true;
- line2.cacheAsBitmap = true;
- }
- function show_pos(pos_array)
- {
- var _loc2_ = new Array();
- var _loc3_ = new Array();
- _loc2_[0] = pos_array[0].x;
- _loc3_[0] = pos_array[0].y;
- i = 1;
- while(i < pos_array.length)
- {
- _loc2_[i] = pos_array[i].x - pos_array[i - 1].x;
- _loc3_[i] = pos_array[i].y - pos_array[i - 1].y;
- i++;
- }
- var _loc4_ = String(_loc2_) + "|" + String(_loc3_);
- trace("x_array=[" + _loc2_ + "]");
- trace("y_array=[" + _loc3_ + "]");
- return _loc4_;
- }
- function set_pos(x_array, y_array)
- {
- var _loc1_ = new Array();
- _loc1_[0] = new Object();
- _loc1_[0].x = x_array[0];
- _loc1_[0].y = y_array[0];
- i = 1;
- while(i < x_array.length)
- {
- _loc1_[i] = new Object();
- _loc1_[i].x = x_array[i] + _loc1_[i - 1].x;
- _loc1_[i].y = y_array[i] + _loc1_[i - 1].y;
- i++;
- }
- return _loc1_;
- }
- function readyPlay()
- {
- trace("获取详细数组" + pos_array.length);
- pos_ID = 1;
- mouth_start._x = pos_array[0].x;
- mouth_start._y = pos_array[0].y;
- mouth._x = pos_array[pos_array.length - 1].x;
- mouth._y = pos_array[pos_array.length - 1].y;
- i = 0;
- while(i < pos_array.length)
- {
- if(i < pos_array.length - 1)
- {
- var _loc2_ = pos_array[i + 1].x - pos_array[i].x;
- var _loc1_ = pos_array[i + 1].y - pos_array[i].y;
- pos_array[i].rotation = Math.round(Math.atan2(_loc1_,_loc2_) * RtoA);
- pos_array[i].dx = Math.round(_loc2_ / lineXishu * 100) / 100;
- pos_array[i].dy = Math.round(_loc1_ / lineXishu * 100) / 100;
- pos_array[i].dr = Math.round((pos_array[i].rotation - pos_array[i - 1].rotation) / lineXishu * 100) / 100;
- }
- else
- {
- pos_array[i].rotation = pos_array[i - 1].rotation;
- pos_array[i].dx = 0;
- pos_array[i].dy = 0;
- pos_array[i].dr = 0;
- }
- pos_array[0].rotation = pos_array[1].rotation;
- pos_array[0].dr = 0;
- i++;
- }
- line.onEnterFrame = function()
- {
- if(!game_pause)
- {
- var _loc1_ = 0;
- while(_loc1_ < 4)
- {
- readyPlay2();
- _loc1_ = _loc1_ + 1;
- }
- }
- };
- }
- function readyPlay2()
- {
- line.attachMovie("dot","dot" + pos_ID,pos_ID);
- line["dot" + pos_ID]._x = pos_array[pos_ID].x;
- line["dot" + pos_ID]._y = pos_array[pos_ID].y;
- pos_ID++;
- if(pos_ID >= pos_array.length - 1)
- {
- delete line.onEnterFrame;
- trace("game play");
- speed_listener.initSpeed();
- play();
- }
- }
- var pos_ID = 0;
-